#include ("/_includes/_layout.html")
#define css()
<link href="#(webctx)/resources/css/pay.css" rel="stylesheet"/>
<style type="text/css">
.account-information {
    font-weight: bold;
    margin-bottom: 30px;
    font-size: 16px;
}
.transfer-entry {
    padding-top: 30px;
}
</style>
#end
#@layout("", "wxmall,点步科技", "Wxmall社区","wxmall") 
#define content()
<div class="wrapper wrapper-content">
	<div class="row content-tabs">
		<nav class="page-tabs J_menuTabs">
	       <div class="page-tabs-content" style="margin-left: 0px;">
	           <a href="#(webctx)/weapptpl" class="J_menuTab active">模板市场</a>
		       <a href="#(webctx)/weapptpl/my" class="J_menuTab">我的模板</a>
	       </div>
	   	</nav>
	</div>
	<div class="row ibox-content">
	<div class="table-responsive">
         <table class="table table-striped table-hover">
             <tbody>
                 <tr>
                     <td class="client-avatar"><img alt="image" src="img/a2.jpg"> </td>
                     <td><a data-toggle="tab" href="#contact-1" class="client-link">袁岳</a>
                     </td>
                     <td> 瑞安市海诚机械有限公司</td>
                     <td class="contact-type"><i class="fa fa-envelope"> </i>
                     </td>
                     <td> gravida@qq.com</td>
                     <td class="client-status"><span class="label label-primary">已验证</span>
                     </td>
                 </tr>
                 <tr>
                     <td class="client-avatar"><img alt="image" src="img/a3.jpg"> </td>
                     <td><a data-toggle="tab" href="#contact-2" class="client-link">王利锋</a>
                     </td>
                     <td>上海沃精机械制造有限公司</td>
                     <td class="contact-type"><i class="fa fa-envelope"> </i>
                     </td>
                     <td> rooney@sina.com</td>
                     <td class="client-status"><span class="label label-primary">已验证</span>
                     </td>
                 </tr>
                 <tr>
                     <td class="client-avatar"><img alt="image" src="img/a4.jpg"> </td>
                     <td><a data-toggle="tab" href="#contact-3" class="client-link">张有为 </a>
                     </td>
                     <td>张家港同丰机械制造有限公司</td>
                     <td class="contact-type"><i class="fa fa-phone"> </i>
                     </td>
                     <td> 13209009485</td>
                     <td class="client-status"></td>
                 </tr>
             </tbody>
         </table>
     </div>
	</div>
</div>
#end
<script type="text/javascript">
	var memberEndDate = $("#purchase_end_date").html();
	var begtime_ms = new Date();
	
	$("#spnTotalFee").text($("ul.selectMonth").find("li.active").attr("data-price") * $("ul.selectMonth").find("li.active").attr("data-month") / 30);
	$("#ExpirTime").text(begtime_ms.addDay_dbu($("ul.selectMonth").find("li.active").attr("data-month")).format_dbu("yyyy年MM月dd日"));
	$("ul.selectMonth li").click(function(){
		$("ul.selectMonth li").each(function(){
			$(this).removeClass("active");
		});
		$(this).addClass("active");
		$("#spnTotalFee").text($(this).attr("data-price")*$(this).attr("data-month") / 30);
	    $("#ExpirTime").text(begtime_ms.addDay_dbu($(this).attr("data-month")).format_dbu("yyyy年MM月dd日"));
	    return false;
	});
	$("ul.terms-payment li").click(function(){
		$("ul.terms-payment li").each(function(){
			$(this).removeClass("active");
		});
		$(this).addClass("active");
		
		if($(this).attr("data-type") == "viewAccount"){
			$("#pay_dg_dialog").modal("show");
		}
		return false;
	});
	
	$("#btnPay").click(function(){
		if($("#moduleId").val() == ""){
			obz.warn("请选择模板");
			return;
		}
		var payType = $("ul.terms-payment").find("li.active").attr("data-type");
		if(payType != "viewAccount"){
			obz.showMessage("确认购买吗？", function(){
				createOrder(payType);				
			});
		}else {
			alert("请选择支付类型");
		}
		return false;
	});
	
	function createOrder(payType){
		var selPurchase = $("ul.selectMonth").find("li.active").attr("data-id");
		var params = {};
		params.purchase = selPurchase;
		params.payType = payType;
		params.moduleId = $("#moduleId").val();
		$(".wrapper-content").mask("正在提交...");
		obz.ajaxJson(obz.ctx + "/pay/create", params, function(resp){
			$(".wrapper-content").unmask();
			if(resp.code == 200){
				//调到支付界面
				document.write(resp.data);
			}
		});
	}
</script>